Constants in C

What are Constants?

Constants in C refer to fixed values that do not change during the execution of a program.

Types of Constants in C

Integer Constants

These are whole numbers, either positive or negative. You can also use different bases like decimal, octal, and hexadecimal.

Example: 123, 017 (octal), 0x7F (hexadecimal)

Floating-point Constants

These represent real numbers and can be written in standard or scientific notation.

Example: 3.14, 2.5e-3

Character Constants

These represent single characters enclosed in single quotes.

Example: 'A', 'b', '1'

String Constants

These are sequences of characters enclosed in double quotes.

Example: "Hello, World!"